Original: http://www.sitepoint.com/beginners-guide-node-package-manager/Installing node. jsVerify that your installation is successful.$ node> Console.log (' node is running '); Node is running>. Help.break Sometimes you get stuck
Nothing to do, study a node. js, although there are a lot of resources on the Internet tutorial, but it is not as good as the memory of their own handwriting to the deep.Create a node server The first step: Download the node. JS installation and configure environment variabl
3.1 Console/19 in node. js3.1.1 Console.log method/193.1.2 Console.error Method/203.1.3 Console.dir Method/213.1.4 Console.time Method and Console.timeend method/223.1.5 Console.trace Method/223.1.6 Console.assert Method/233.2 Global scope and global functions in node. js/233.2.1 Global scope/23 in node. js3.2.2 settim
10.1 Handling Errors using domain module/27210.1.1 Domain Module Overview/27210.1.2 Creating and Using domain objects/27410.1.3 implicit binding vs. explicit binding/27610.1.4 binding callback function with intercept callback function/27910.1.5 the pop-up and push-in of the domain stack/280Destruction of 10.1.6 domain objects/28610.2 Assertion processing in node. js/28610.2.1 equal method and NotEqual metho
12.1 Using DNS module to resolve domain name/31312.1.1 using the Resolve method to resolve a domain name to a DNS record/31312.1.2 using the Lookup method to query the IP address/31512.1.3 using the reverse method to reverse Resolve IP address/31612.1.4 various error codes in the DNS module/31712.2 Using the Punycode module to convert Punycode encoding/31812.3 using OS module for operating system Information/32012.4 Reading stream data row by line using the ReadLine module/32312.4.1 creating int
6.1 Synchronous Methods vs. async methods/856.2 Read/write to File/86Full read/write of the 6.2.1 file/866.2.2 start reading/writing files from a specified location/916.3 Creating and Reading directories/976.3.1 Creating a Directory/976.3.2 Reading directory/986.4 Viewing and modifying a file or directory information/996.4.1 View information for a file or directory/996.4.2 checking whether a file or directory exists/1016.4.3 get the absolute path of a file or directory/1026.4.4 Modify file acces
Three o'clock in the morning, when the console is activated, the hand is pressed on the keyboard. A glaring hint appeared on the black background, craving to receive commands. Want to toss the next node.js?node,js there's an exciting message: it can run anywhere. This gives the stack a variety of different ways to try it out. For any seasoned person, running with the command line is fun. My favorite is the
Introduction to the Node. js lightweight Web framework Express4.x User Guide, node. jsexpress4.x
Express is a lightweight Web framework that is simple and flexible
It is also the most popular Nodejs-based Web framework.
With this feature, we can quickly build a complete website (express)
Express is now in version 4.x,
, and image folders are in the same directory as the HTML folder where the page resides.I believe that through this example, we have been able to simply let a static website on our server support up. The next time we will simply deploy a file system, I hope you can continue to pay attention to. Novice on the road, the article code written are relatively rough, I hope you correct. ByeTags: node. js good text
for the node. JS installation It is easy to find the corresponding computer version directly to install it, so far as you know, without any configuration. once installed, you will have node. js Command prompt running the program directly. then you can create the first applet, create a file directly in a folder, such as
, the test folder has b.js, c.js, 1.txtA To reference B:
var B = require ("./test/b.js");
B To reference C:
var B = require ("./c.js");
However, when other modules such as FS are used in the path, they are relative to the position of the cmd command cursor.Therefore, in b.js to read 1.txt files, it is recommended to use absolute path:
Fs.readfile (__dirname + "/1.txt", function (Err,data) {if (err) {throw err;}Console.log (Da
node. JS Three features: single-threaded, nonblocking I/O, event-drivenFirst, create a HelloWorld1, the normal download installs the node. js package;2. cmd command, enter the directory where node. JS Installer is located: Cd:c:\p
I. Installation and Environment configuration:The two articles are very detailed.Http://www.cnblogs.com/seanlv/archive/2011/11/22/2258716.htmlHttp://www.tuicool.com/articles/UJNb2eJTwo. Test case (Chinese garbled problem has been solved)var http = require ("http");Http.createserver (function (request, response) {Response.writehead ($, {"Content-type": "Text/plain;charset=utf-8"});Response.Write ("node is running, Test here");Response.End ();}). Listen
3.1 Start programming with node. js3.1.1 Hello WorldSave the following source code in the Helloworld.js fileConsole.log (' Hello world! ' ); Console.log ('%s:%d ', ' hello ', 25);Locate the file location and execute node helloworld.js. The results are as follows:3.1.2 node. JS Command-line toolInput:
"Node. JS Development Guide" This book, which only has more than 180 pages, I spent one months in my spare time is a rough look. In the middle because the company project overtime, interrupted several times. Greatly drag the progress, now empty out of time, write a little bit of their own feelings.Start with the disadvantages first: I think the biggest drawback
. JSON in interactive mode
NPM adduser generates users on the node repo website through interaction
NPM publish can publish the package. If necessary, update the version number in package. JSON and re-publish.
NPM unpublish can unpack
3.3 debugging
3.3.1 node debug
Node debug script. js can be debugged under the comman
Node. js Express Installation Guide
I. Installation
To create a project, the system prompts that the express command is not found.
Npm install-g express-generator # install express-generator firstNpm install-g expressExpress-V # verify whether the installation is successful
2. Create a project
$ Express myfirstexpress # The default template of express uses jade.
. One-time loadingvar myModule1 = require ('./module ');Mymodule.setname (' Andy ');var myModule2 = require ('./module ');Mymodule.setname (' King ');Mymodule.sayhello ();//hello KingBecause they point to the same instance, MyModule1 is covered by myModule23. Cover exportsfunction Hello () {var name;This.setname = function (thyname) {name = Thyname;};This.sayhello = function () {Console.log (' Hello ' + name);};};Exports. Hello = hello;//before Hello is an exposed attribute to the outside world
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.